/*
 * Exploder
 * 
 * Tero Pyylampi (218437), Jussi Tuurinkoski (211594)
 *
 * Interface for saving & loading user data
 * which includes everything related to game
 */

#ifndef USERDATA_H
#define USERDATA_H

#include "cocos2d.h"

// saved game data
struct GameData {
	// current money saved
	unsigned int currentMoney;

	// amount of stars reached per level
	// format: [ 0 .. 9 ] = LEVEL 1 STARS, LEVEL 2 STARS, ..., LEVEL 10 STARS
	unsigned int *starsCollected;
};

class UserData {
public:
	// default constructor, loads settings
	UserData( unsigned int playerNro = 0 );
	// default desturctor, saves settings
	~UserData();

	// get saved game data
	GameData *getGameData();

	// explicitely save settings
	void saveAllSettingsAndData();

private:
	// current player
	unsigned int mPlayerNro;

	// currently loaded settings & game data
	GameData *mGameData;

	// loads settings and data
	void loadAllSettingsAndData();

	// creates the string to be parsed for levels
	std::string createLevelString( unsigned int *levels );
	// returns the stars for levels
	unsigned int *parseLevelString( std::string s );
};

#endif
